Skip to content

fix(SongWiki): ID 变化时数据不更新#1003

Merged
imsyy merged 1 commit intoimsyy:devfrom
MoYingJi:pr/rf
Mar 19, 2026
Merged

fix(SongWiki): ID 变化时数据不更新#1003
imsyy merged 1 commit intoimsyy:devfrom
MoYingJi:pr/rf

Conversation

@MoYingJi
Copy link
Collaborator

在「音乐百科」界面,通过下方的「相似歌曲」打开其它歌曲的「音乐百科」,那么页面将不会更新

Copilot AI review requested due to automatic review settings March 17, 2026 13:29
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

此拉取请求旨在解决「音乐百科」页面在用户导航至不同歌曲时数据不刷新的问题。通过调整数据获取逻辑和引入路由更新监听器,确保了在 ID 变化时页面内容能够及时反映最新的歌曲信息,从而提升了用户体验。

Highlights

  • 修复数据更新问题: 当用户在「音乐百科」页面通过「相似歌曲」导航到另一首歌曲的百科时,页面数据未能正确更新的问题已得到解决。
  • 优化 fetchData 函数: fetchData 函数现在接受一个可选的 ID 参数,使其可以在路由更新时直接接收新的歌曲 ID。
  • 引入路由更新监听: 新增 onBeforeRouteUpdate 钩子,确保在同一路由组件内,当路由参数(如歌曲 ID)发生变化时,能够主动触发数据重新加载。
Changelog
  • src/views/Song/wiki.vue
    • 修改了 fetchData 函数,使其可以接受可选的歌曲 ID 参数。
    • 简化了 onActivated 钩子,直接调用 fetchData。
    • 新增了 onBeforeRouteUpdate 钩子,用于监听路由参数变化并重新加载数据。
Activity
  • 没有检测到此拉取请求的任何活动。
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the Song Wiki view to refresh its data when the route query (id) changes, ensuring the page stays in sync when navigating between songs without fully leaving the view.

Changes:

  • Refactors fetchData to accept an optional song id parameter (falling back to route.query.id when omitted).
  • Simplifies onActivated to always call fetchData (which now self-guards against duplicate loads).
  • Adds an onBeforeRouteUpdate hook to reload wiki data when navigating within the song-wiki route.

You can also share your feedback on Copilot code review. Take the survey.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

这个 PR 修复了在「音乐百科」页面,从「相似歌曲」部分导航到另一个歌曲的百科页面时,页面数据不会更新的 bug。解决方案是使用 onBeforeRouteUpdate 钩子,在路由的查询参数变化时重新获取数据,这是正确的做法。代码逻辑清晰,解决了所述问题。我有一个小建议,可以移除 onBeforeRouteUpdate 钩子中一个多余的检查来简化代码。

在「音乐百科」界面,通过下方的「相似歌曲」打开其它歌曲的「音乐百科」,那么页面将不会更新
@imsyy imsyy merged commit 6983106 into imsyy:dev Mar 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants